#include<iostream>
using namespace std;
const int N = 1e6 + 10;
int arr[N];
int n, m;
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	int x;
	while (m--) {
		cin >> x;
		int l = 1, r = n;
		while (l < r) {
			int mid = l + r >> 1;
			if (arr[mid] >= x) {
				r = mid;
			}
			else {
				l = mid + 1;
			}
		}
		if (arr[l] == x) {
			cout << l << " ";
		}
		else {
			cout << -1 << endl;
		}
	}
	return 0;
}